home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRON
/
1009.ZIP
/
HAM2.ARC
/
CONLOG.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-05-12
|
8KB
|
211 lines
1 ' CONLOG - a vhf/uhf contest scoring program by G4PMK and G3SEK,
2 ' based on the program in "Amateur Radio Software" by GM4ANB (RSGB).
3 ' This version has the following extras -
4 ' Partially completed log can be saved in a file called LOG.DAT
5 ' Location input can be either WW or Eu locator, or distance in km.
6 ' WW locator can use short entry for default field,
7 ' eg "91IP" becomes "IO91IP".
8 ' Duplicate QSOs are queried on location input.
9 ' Plus extra editing facilities.
10 UP$=CHR$(30) ' IBM cursor-up
15 BAK$=CHR$(29) ' IBM cursor-back
20 CLREOL$=STRING$(70,32)+STRING$(70,BAK$) ' Print 70 spaces and backstep
40 MC=1200:HF$="IO": ' Max. contacts, home locator field; edit if necessary
50 DIM L$(MC),N(MC): PI=3.14159
60 GOSUB 1600
70 PRINT "Use saved log data from LOG.DAT on current drive? (Y/N) : ";
80 ZZ$=INKEY$:IF ZZ$="" THEN GOTO 80
90 IF ZZ$<>"y" AND ZZ$<>"Y" THEN GOTO 160
100 PRINT "Loading log data from LOG.DAT .....":PRINT
110 OPEN "I",#1,"LOG.DAT"
120 INPUT #1, OWN.QRA$,CN,TD,TP,DX,BD,BC,OD,OC,PN,PP,PD,PC,E1,N1,SS,P,LOST,DUP
130 FOR I=1 TO MC
140 INPUT #1, L$(I),N(I):NEXT I
150 CLOSE #1:Q$=OWN.QRA$:PRINT:PRINT " Last QSO number ";N(P),"Locator : ";L$(P):PRINT:GOTO 700
158 '
159 ' New home locator and initialization
160 PRINT:PRINT:INPUT "Home locator : ",Q$
170 OWN.QRA$=Q$
180 GOSUB 870
190 IF F>.5 THEN GOTO 160
200 E1=E:N1=N
210 CN=1:TD=0:TP=0:DX=0
220 BD=0:BC=0:OD=0:OC=0
230 PN=1
240 PP=0:PD=0:PC=0
250 PRINT:PRINT "Page ";PN:PRINT
258 '
259 ' Input starts here
260 IF CN<1 THEN CN=1
265 KM=0
270 PRINT "QSO No.";CN;" Locator or Distance ";
280 M=1:INPUT Q$:IF Q$="" THEN GOTO 260
290 IF Q$=OWN.QRA$ OR HF$+Q$=OWN.QRA$ THEN GOTO 830
295 IF Q$="0" THEN LOST=LOST+1:DX=0:PT=0:GOTO 610
300 IF Q$="END" OR Q$="SAVE" THEN GOTO 1120
310 IF Q$="PAGE"OR Q$= "TOTAL" THEN GOTO 700
315 IF Q$="?" THEN GOSUB 1610: GOTO 270
320 IF LEFT$(Q$,1)<>"-" THEN GOTO 340
330 M=-1:Q$=MID$(Q$,2):IF Q$="" THEN GOTO 530
340 F=0:FOR J=1 TO LEN(Q$):T$=MID$(Q$,J,1)
350 IF(T$<"0" OR T$>"9") AND T$<>"." THEN F=1
360 NEXT J
370 IF F>.5 THEN GOTO 400
378 '
379 ' Distance hashing
380 DX=VAL(Q$):IF DX<>0 THEN SS=INT(DX/10)+1000:P=SS:KM=1:GOTO 430
390 PT=0:GOTO 610
398 '
399 ' Distance calculation and locator filing
400 GOSUB 870:IF F<.5 THEN GOTO 430
410 PRINT CHR$(7):PRINT"BAD INPUT":GOTO 260
430 IF N(P)=0 THEN GOTO 570
440 IF L$(P)<>Q$ THEN GOTO 500
450 PRINT"Locator same as QSO No. ";N(P);
460 PRINT" Is this a duplicate contact? (Y/N) : ";CHR$(7);
470 ZZ$=INKEY$:IF ZZ$= "" THEN GOTO 470 ELSE PRINT UP$;CLREOL$;
480 IF ZZ$<>"Y" AND ZZ$<>"y" THEN GOTO 500 ELSE DUP=DUP+1
490 PT=0:DX=0:GOTO 610
500 P=P+1:IF P>MC THEN P=1
510 IF ABS(P-SS)>.5 THEN GOTO 430
520 PRINT"Locator table full!":PRINT CHR$(7),CHR$(7):END
528 '
529 ' Erase a contact
530 ZZ=1
535 PRINT "Please wait a moment....."
540 IF N(ZZ)<>CN-1 THEN ZZ=ZZ+1:IF ZZ>MC THEN GOTO 1260 ELSE GOTO 540
550 Q$=L$(ZZ):L$(ZZ)="":N(ZZ)=0
560 PRINT:PRINT CHR$(7); Q$;" Contact number ";CN-1;" is erased":PRINT:IF ZZ>1000 THEN GOTO 565 ELSE GOSUB 870:GOTO 580
565 DX=VAL(Q$):GOTO 600
568 '
569 ' Subroutine for distance calculation and best DX
570 L$(P)=Q$:N(P)=CN
575 IF KM=1 THEN GOTO 600
580 DX=SIN(N1)*SIN(N) + COS(N1)*COS(N)*COS(E1-E)
585 TEMP=1-DX*DX:IF TEMP<0 THEN TEMP=0
590 DX=6367.6*ATN(SQR(TEMP)/DX)
595 IF DX<1 THEN DX=1
600 PT=M*(2*INT(DX/50) + 1):DX=M*INT(DX)
605 IF DX/50=INT(DX/50) THEN PT=PT+(M*-2)
610 PRINT TAB(44);UP$; DX;"km",PT;" pts"
620 TD=TD+DX:TP=TP+PT
630 PD=PD+DX:PP=PP+PT:PC=PC+M
640 CN=CN+M:IF DX>0 THEN GOTO 670
650 DX=-DX:IF DX<BD THEN GOTO 260
660 PRINT"Best DX cancelled":BC=OC:BD=OD:GOTO 260
670 IF DX<BD THEN GOTO 260
680 IF CN>2 THEN PRINT"*** New best DX ***"
690 OD=BD:OC=BC:BD=DX:BC=CN-M:GOTO 260
698 '
699 ' End-of-page processing
700 T=CN-1:PRINT :PRINT TAB(10);"Totals so far:"
710 PRINT:PRINT T;" QSOs":IF T<1 THEN T=1
720 PRINT TD;"km",INT(TD/T);"km/QSO"
730 PRINT TP;" pts",INT(TP*100/T)/100;" pts/QSO"
735 PRINT:PRINT LOST;" lost QSOs ";DUP; " duplicate QSOs":PRINT:PRINT
740 T=PC:PRINT:PRINT" Subtotals for page ";PN
750 PRINT T;" QSOs":IF T<1 THEN T=1
760 PRINT PD;"km",INT(PD/T);"km/QSO"
770 PRINT PP;" pts",INT(PP*100/T)/100;" pts/QSO"
780 PRINT:PRINT"Best DX ";BD;"km, QSO No ";BC
790 PRINT:PRINT"Start a new page? (Y/N) :"
800 ZZ$=INKEY$:IF ZZ$="" THEN GOTO 800
810 IF ZZ$="Y" OR ZZ$="y"THEN PN=PN+1:GOTO 240
820 GOTO 260
828 '
829 ' Local QSO
830 PRINT CHR$(7); "Really a QSO in your own square? (Y/N) ";
840 ZZ$=INKEY$:IF ZZ$="" THEN GOTO 840 ELSE PRINT UP$;CLREOL$;
850 IF ZZ$<>"Y" AND ZZ$<>"y" THEN GOTO 490
860 DX=1:GOTO 600
868 '
869 ' Subroutine for locator processing
870 F=1:IF LEN(Q$)=4 THEN Q$=HF$+Q$:PRINT Q$
875 IF LEN(Q$)=6 THEN GOSUB 1300:RETURN
879 ' Old QRA locator
880 IF LEN(Q$)<>5 THEN RETURN
890 E=60*(ASC(LEFT$(Q$,1))-ASC("A"))
900 IF (E<0) OR (E>1500) THEN RETURN
910 N=48*(ASC(MID$(Q$,2,1))-ASC("A"))
920 IF (N<0) OR (N>1200) THEN RETURN
930 T$=MID$(Q$,3,1)
940 IF (T$<"0") OR (T$>"8") THEN RETURN
950 T$=MID$(Q$,4,1)
960 IF (T$<"0") OR (T$>"9") THEN RETURN
970 T=VAL(MID$(Q$,3,2))
980 IF (T>80) OR (T<1) THEN RETURN
990 T=(T-1)/10
1000 N=N+6*(7-INT(T))
1010 E=E+60*(T-INT(T))
1020 A$=RIGHT$(Q$,1):IF (A$<"A") OR (A$="I") OR (A$>"J") THEN RETURN
1030 IF (A$="A") OR (A$="J") OR (A$="E") THEN E=E+2
1040 IF (A$="B") OR (A$="C") OR (A$="D") THEN E=E+4
1050 IF (A$="G") OR (A$="J") OR (A$="C") THEN N=N+2
1060 IF (A$="H") OR (A$="A") OR (A$="B") THEN N=N+4
1070 N=N+1921:E=E+1
1080 IF (E>1200) THEN E=E-1560
1090 E=E*PI/5400
1100 N=N*PI/8640
1109 ' Old QRA hashing
1110 SS=INT(MC*VAL(MID$(Q$,3,2))/99):P=SS:F=0:RETURN
1118 '
1119 ' Rewrite file
1120 PRINT
1130 PRINT "Saving current log contents in LOG.DAT .....":PRINT
1140 FI$="LOG.DAT"
1150 ' OPEN "O",#1,FI$ ' Can't kill an open file in IBM BASIC.
1160 ' KILL FI$ ' Can't kill a non-existent file either.
1170 ' CLOSE
1180 OPEN "O",#1,FI$
1190 PRINT #1, OWN.QRA$;",";CN;TD;TP;DX;BD;BC;OD;OC;PN;PP;PD;PC;E1;N1;SS;P;LOST;DUP
1200 FOR I=1 TO MC
1210 PRINT #1, L$(I);",";N(I)
1220 NEXT I
1230 CLOSE
1240 IF Q$="SAVE" THEN GOTO 250
1250 END
1259 '
1260 PRINT "That must have been a non-scoring contact....."
1270 CN=CN-1:LOST=LOST-1:PC=PC-1
1280 GOTO 260
1298 '
1299 ' Routine for new world locator (Maidenhead) system
1300 IF LEN(Q$)<>6 THEN RETURN
1310 T=1:GOSUB 1400
1320 E=N+N
1330 IF F>.5 THEN RETURN
1340 F=1:T=2:GOSUB 1400
1350 IF F>.5 THEN RETURN
1359 ' Maidenhead hashing
1360 SS=25*(ASC(MID$(Q$,5,1))-ASC("A"))+ASC(MID$(Q$,6,1))-ASC("A")+1
1370 SS=INT(MC*SS/720):P=SS
1380 RETURN
1399 ' Subroutine for Maidenhead
1400 N=ASC(MID$(Q$,T,1))-ASC("A")
1410 IF N<0 OR N>17 THEN RETURN
1420 T$=MID$(Q$,T+2,1)
1430 IF T$<"0" OR T$>"9" THEN RETURN
1440 N=N*10+ASC(T$)-ASC("0")
1450 T$=MID$(Q$,T+4,1)
1460 IF T$<"A" OR T$>"X" THEN RETURN
1470 N=N*24+ASC(T$)-ASC("A")
1480 N=N-2160+.5
1490 N=N*PI/4320
1500 F=0:RETURN
1598 '
1599 ' Startup screen
1600 CLS:PRINT:PRINT TAB(5);"CONLOG : Contest scoring program ver4.0 by G4PMK"
1610 PRINT:PRINT" Inputs are accepted as either -":PRINT TAB(10);"Maidenhead Locator (eg ";HF$;"91IP),"
1620 PRINT TAB(10);"(default locator field ";HF$;" can be omitted, eg 91IP is acceptable);"
1630 PRINT TAB(7);"or European locator (eg ZL24E);"
1640 PRINT TAB(7);"or distance in kilometres. Enter 0 for a non-scoring contact."
1650 PRINT:PRINT" Duplicate contacts are checked by comparing locator/distance input."
1660 PRINT:PRINT" Input '-' to remove the last entry."
1670 PRINT" 'TOTAL' or 'PAGE' will give page/scoresheet totals."
1680 PRINT" 'SAVE' saves the current log table, then continues (use as backup)."
1690 PRINT" 'END' saves the current status for next time, and quits."
1700 PRINT:PRINT" '?' will display this information again."
1710 PRINT:PRINT
1720 RETURN
16430 PRINT TAB(30);"or a distance in kilometres. Enter 0 for a non-scoring contact."